package com.danielepelagatti.flickrmanager.commands.people
{
	import com.adobe.cairngorm.control.CairngormEventDispatcher;
	import com.adobe.webapis.flickr.User;
	import com.adobe.webapis.flickr.events.FlickrResultEvent;
	import com.danielepelagatti.flickrmanager.commands.FlickrCommand;
	import com.danielepelagatti.flickrmanager.commands.IFlickrCommand;
	import com.danielepelagatti.flickrmanager.events.PeopleEvent;
	import com.danielepelagatti.flickrmanager.model.Flickr;
	import com.danielepelagatti.flickrmanager.model.LocalUser;
	import com.danielepelagatti.flickrmanager.model.States;
	
	import mx.utils.ObjectProxy;
	/**
	 * 
	 * @author dpelagatti
	 * 
	 */
	public class GetInfo extends FlickrCommand implements IFlickrCommand
	{
		/**
		 * 
		 * @param event
		 * 
		 */		
		public function error(event:FlickrResultEvent):Boolean
		{
			return false;
		}
		/**
		 * 
		 * @param event
		 * 
		 */		
		public function success(event:FlickrResultEvent):void
		{
			LocalUser.getInstance().user = new ObjectProxy(User(event.data.user));
			States.getInstance().state = States.VIEW_PHOTOS;
			
			/* CairngormEventDispatcher.getInstance().dispatchEvent
			(
				new PeopleEvent
				(
					PeopleEvent.GET_PUBLIC_PHOTOS,
					[
						LocalUser.getInstance().user.nsid,
						"license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags"
					]
				)
			); */
		}
		/**
		 * 
		 * @return 
		 * 
		 */		
		public function getAPICall():Function
		{
			return flickr.people.getInfo;
		}
		
	}
}